package com.boglond;

import com.boglond.builder.*;
import com.boglond.entity.TableInfoDO;
import com.boglond.util.TableUtil;
import lombok.extern.slf4j.Slf4j;

import java.util.List;


@Slf4j
public class CodePrinterStarter {


    public static void main(String[] args) {

        List<TableInfoDO> tableInfoDOList = TableUtil.getAllTableAndColumnsInfo();
        GenerateXMLInterface generateXMLInterface = new GenerateXMLInterfaceImpl();
        GenerateMapperInterface generateMapperInterface = new GenerateMapperInterfaceImpl();
        GeneratePOInterface generatePOInterface = new GeneratePOInterfaceImpl();
        GenerateRepositoryInterface generateRepositoryInterface = new GenerateRepositoryInterfaceImpl();
        GenerateServiceInterface generateServiceInterface = new GenerateServiceInterfaceImpl();
        GenerateDTOInterface generateDTOInterface = new GenerateDTOInterfaceImpl();
        GenerateExceptionInterface generateExceptionInterface = new GenerateExceptionInterfaceImpl();

        //生成mapper xml文件
        generateXMLInterface.createMapperXML(tableInfoDOList);

        //生成Mapper类
        generateMapperInterface.createMapperClass(tableInfoDOList);

        //生成PO类
        generatePOInterface.createPOClass(tableInfoDOList);

        //生成Repository类
        generateRepositoryInterface.createRepositoryClass(tableInfoDOList);
        generateRepositoryInterface.createRepositoryImplClass(tableInfoDOList);

        //生成基础Service类
        generateServiceInterface.createBasicServiceClass(tableInfoDOList);
        generateServiceInterface.createBasicServiceImplClass(tableInfoDOList);

        //生成业务Service类
//        generateServiceInterface.createBusinessServiceClass(tableInfoDOList);
//        generateServiceInterface.createBusinessServiceImplClass(tableInfoDOList);

        //生成REST Service类
        generateServiceInterface.createRestServiceClass(tableInfoDOList);
        generateServiceInterface.createRestServiceImplClass(tableInfoDOList);

        //生成 service add req dto
//        generateDTOInterface.createServiceAddReqDTOClass(tableInfoDOList);
        //生成 service upd req dto
//        generateDTOInterface.createServiceUpdReqDTOClass(tableInfoDOList);
        //生成 service qry req dto
        generateDTOInterface.createServiceQryReqDTOClass(tableInfoDOList);
        //生成 service del req dto
        generateDTOInterface.createServiceDelReqDTOClass(tableInfoDOList);
        //生成 service add resp dto
        generateDTOInterface.createServiceAddRespDTOClass(tableInfoDOList);
        //生成 service qry resp dto
        generateDTOInterface.createServiceQryRespDTOClass(tableInfoDOList);
        //生成 rest add req dto
//        generateDTOInterface.createRestAddReqDTOClass(tableInfoDOList);
        //生成 rest del req dto
        generateDTOInterface.createRestDelReqDTOClass(tableInfoDOList);
        //生成 rest upd req dto
//        generateDTOInterface.createRestUpdReqDTOClass(tableInfoDOList);
        //生成 rest qry req dto
        generateDTOInterface.createRestQryReqDTOClass(tableInfoDOList);
        //生成 rest add resp dto
        generateDTOInterface.createRestAddRespDTOClass(tableInfoDOList);
        //生成 rest qry resp dto
        generateDTOInterface.createRestQryRespDTOClass(tableInfoDOList);

        //生成 ErrorCode 枚举类
        generateExceptionInterface.createErrorCodeClass(tableInfoDOList);

        //生成 ServiceException 类
        generateExceptionInterface.createServiceExceptionClass(tableInfoDOList);

    }
}
